<template>
  <div>
    <el-table :data="tableData" style="width: 100%" @row-click="toDetail">
      <el-table-column prop="id" label="订单号" width="180"> </el-table-column>
      <el-table-column prop="createTime" label="下单时间" width="180"></el-table-column>
      <el-table-column prop="name" label="点餐人" width="180"></el-table-column>
      <el-table-column prop="tel" label="联系方式" width="180"></el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "OrderList",
  data() {
    return {
      tableData: [
        {
          id: "0",
          createTime: "2016-05-02",
          name:'dhy',
          tel:'13250580894',
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          id: "0",
          createTime: "2016-05-02",
          name:'dhy',
          tel:'13250580894',
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],
    };
  },
  methods:{
    
    toDetail(row, column, event){
      this.$router.push({
        path:'/orderDetail',
        query:{
          id:row.id
        }
      })
    }
  },
  mounted() {
    let userId = this.$store.state.userId;
    //console.log(userId);

    this.$axios.post('/storeOrderList',{
      userId
    }).then(res=>{
      for (let t of res.data) {
          t.createTime = this.$moment(t.createTime).format('YYYY-MM-DD HH:mm:ss');
        }
      this.tableData = res.data;
    })

  },
};
</script>

<style scoped>
</style>